/**
 * This is a generated class and is not intended for modification.  To customize behavior
 * of this value object you may modify the generated sub-class of this class - FuncionarioVO.as.
 */

package valueObjects
{
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.valueobjects.IValueObject;
import flash.events.EventDispatcher;
import mx.collections.ArrayCollection;
import mx.events.PropertyChangeEvent;
import valueObjects.CargoVO;
import valueObjects.ContatoClienteVO;
import valueObjects.DepartamentoVO;
import valueObjects.EmpresaVO;
import valueObjects.EnderecoClienteVO;
import valueObjects.StatusVO;
import valueObjects.TituloVO;
import valueObjects.UsuarioVO;

import flash.net.registerClassAlias;
import flash.net.getClassByAlias;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;

use namespace model_internal;

[ExcludeClass]
public class _Super_FuncionarioVO extends flash.events.EventDispatcher implements com.adobe.fiber.valueobjects.IValueObject
{
    model_internal static function initRemoteClassAliasSingle(cz:Class) : void
    {
        try
        {
            if (flash.net.getClassByAlias("com.event.management.vo.FuncionarioVO") == null)
            {
                flash.net.registerClassAlias("com.event.management.vo.FuncionarioVO", cz);
            }
        }
        catch (e:Error)
        {
            flash.net.registerClassAlias("com.event.management.vo.FuncionarioVO", cz);
        }
    }

    model_internal static function initRemoteClassAliasAllRelated() : void
    {
        valueObjects.UsuarioVO.initRemoteClassAliasSingleChild();
        valueObjects.PerfilUsuarioVO.initRemoteClassAliasSingleChild();
        valueObjects.MenuSistemaVO.initRemoteClassAliasSingleChild();
        valueObjects.ItemMenuSistemaVO.initRemoteClassAliasSingleChild();
        valueObjects.PermissaoUsuarioVO.initRemoteClassAliasSingleChild();
        valueObjects.OperacaoVO.initRemoteClassAliasSingleChild();
        valueObjects.AreaUsuarioVO.initRemoteClassAliasSingleChild();
        valueObjects.StatusVO.initRemoteClassAliasSingleChild();
        valueObjects.GrupoStatusVO.initRemoteClassAliasSingleChild();
        valueObjects.EnderecoClienteVO.initRemoteClassAliasSingleChild();
        valueObjects.ClienteVO.initRemoteClassAliasSingleChild();
        valueObjects.ContatoClienteVO.initRemoteClassAliasSingleChild();
        valueObjects.ContatoVO.initRemoteClassAliasSingleChild();
        valueObjects.TipoContatoVO.initRemoteClassAliasSingleChild();
        valueObjects.EventoVO.initRemoteClassAliasSingleChild();
        valueObjects.TipoEventoVO.initRemoteClassAliasSingleChild();
        valueObjects.PalestranteVO.initRemoteClassAliasSingleChild();
        valueObjects.EnderecoPalestranteVO.initRemoteClassAliasSingleChild();
        valueObjects.EnderecoVO.initRemoteClassAliasSingleChild();
        valueObjects.CidadeVO.initRemoteClassAliasSingleChild();
        valueObjects.EstadoVO.initRemoteClassAliasSingleChild();
        valueObjects.PublicacaoVO.initRemoteClassAliasSingleChild();
        valueObjects.RamoAtividadeVO.initRemoteClassAliasSingleChild();
        valueObjects.RotuloVO.initRemoteClassAliasSingleChild();
        valueObjects.AreaAtuacaoVO.initRemoteClassAliasSingleChild();
        valueObjects.EmpresaVO.initRemoteClassAliasSingleChild();
        valueObjects.EnderecoEmpresaVO.initRemoteClassAliasSingleChild();
        valueObjects.ContatoEmpresaVO.initRemoteClassAliasSingleChild();
        valueObjects.FormaContratacaoVO.initRemoteClassAliasSingleChild();
        valueObjects.PropostaIncompanyVO.initRemoteClassAliasSingleChild();
        valueObjects.DepartamentoVO.initRemoteClassAliasSingleChild();
        valueObjects.CargoVO.initRemoteClassAliasSingleChild();
        valueObjects.FonteSolicitacaoVO.initRemoteClassAliasSingleChild();
        valueObjects.AreaTemaVO.initRemoteClassAliasSingleChild();
        valueObjects.RotuloEmpresaVO.initRemoteClassAliasSingleChild();
        valueObjects.TipoEnderecoVO.initRemoteClassAliasSingleChild();
        valueObjects.LogradouroVO.initRemoteClassAliasSingleChild();
        valueObjects.BairroVO.initRemoteClassAliasSingleChild();
        valueObjects.TituloVO.initRemoteClassAliasSingleChild();
        valueObjects.OrcamentoEventoVO.initRemoteClassAliasSingleChild();
        valueObjects.LocalEventoVO.initRemoteClassAliasSingleChild();
        valueObjects.EnderecoLocalVO.initRemoteClassAliasSingleChild();
        valueObjects.RotuloClienteVO.initRemoteClassAliasSingleChild();
        valueObjects.InscricaoVO.initRemoteClassAliasSingleChild();
        valueObjects.TipoInscricaoVO.initRemoteClassAliasSingleChild();
    }

    model_internal var _dminternal_model : _FuncionarioVOEntityMetadata;
    model_internal var _changedObjects:mx.collections.ArrayCollection = new ArrayCollection();

    public function getChangedObjects() : Array
    {
        _changedObjects.addItemAt(this,0);
        return _changedObjects.source;
    }

    public function clearChangedObjects() : void
    {
        _changedObjects.removeAll();
    }

    /**
     * properties
     */
    private var _internal_usuarioUltimaAlteracaao : valueObjects.UsuarioVO;
    private var _internal_clienteEspecial : int;
    private var _internal_status : valueObjects.StatusVO;
    private var _internal_clienteEspecialFormatado : String;
    private var _internal_dataUltimaAlteracao : Date;
    private var _internal_motivoStatus : String;
    private var _internal_enderecos : ArrayCollection;
    model_internal var _internal_enderecos_leaf:valueObjects.EnderecoClienteVO;
    private var _internal_observacao : String;
    private var _internal_cargo : valueObjects.CargoVO;
    private var _internal_codigo : Number;
    private var _internal_titulo : valueObjects.TituloVO;
    private var _internal_usuarioUltimaAlteracao : valueObjects.UsuarioVO;
    private var _internal_departamento : valueObjects.DepartamentoVO;
    private var _internal_contatos : ArrayCollection;
    model_internal var _internal_contatos_leaf:valueObjects.ContatoClienteVO;
    private var _internal_empresa : valueObjects.EmpresaVO;
    private var _internal_usuarioCadastro : valueObjects.UsuarioVO;
    private var _internal_nome : String;
    private var _internal_dataNascimento : Date;
    private var _internal_cpf : String;
    private var _internal_dataCadastro : Date;

    private static var emptyArray:Array = new Array();


    /**
     * derived property cache initialization
     */
    model_internal var _cacheInitialized_isValid:Boolean = false;

    model_internal var _changeWatcherArray:Array = new Array();

    public function _Super_FuncionarioVO()
    {
        _model = new _FuncionarioVOEntityMetadata(this);

        // Bind to own data or source properties for cache invalidation triggering

    }

    /**
     * data/source property getters
     */

    [Bindable(event="propertyChange")]
    public function get usuarioUltimaAlteracaao() : valueObjects.UsuarioVO
    {
        return _internal_usuarioUltimaAlteracaao;
    }

    [Bindable(event="propertyChange")]
    public function get clienteEspecial() : int
    {
        return _internal_clienteEspecial;
    }

    [Bindable(event="propertyChange")]
    public function get status() : valueObjects.StatusVO
    {
        return _internal_status;
    }

    [Bindable(event="propertyChange")]
    public function get clienteEspecialFormatado() : String
    {
        return _internal_clienteEspecialFormatado;
    }

    [Bindable(event="propertyChange")]
    public function get dataUltimaAlteracao() : Date
    {
        return _internal_dataUltimaAlteracao;
    }

    [Bindable(event="propertyChange")]
    public function get motivoStatus() : String
    {
        return _internal_motivoStatus;
    }

    [Bindable(event="propertyChange")]
    public function get enderecos() : ArrayCollection
    {
        return _internal_enderecos;
    }

    [Bindable(event="propertyChange")]
    public function get observacao() : String
    {
        return _internal_observacao;
    }

    [Bindable(event="propertyChange")]
    public function get cargo() : valueObjects.CargoVO
    {
        return _internal_cargo;
    }

    [Bindable(event="propertyChange")]
    public function get codigo() : Number
    {
        return _internal_codigo;
    }

    [Bindable(event="propertyChange")]
    public function get titulo() : valueObjects.TituloVO
    {
        return _internal_titulo;
    }

    [Bindable(event="propertyChange")]
    public function get usuarioUltimaAlteracao() : valueObjects.UsuarioVO
    {
        return _internal_usuarioUltimaAlteracao;
    }

    [Bindable(event="propertyChange")]
    public function get departamento() : valueObjects.DepartamentoVO
    {
        return _internal_departamento;
    }

    [Bindable(event="propertyChange")]
    public function get contatos() : ArrayCollection
    {
        return _internal_contatos;
    }

    [Bindable(event="propertyChange")]
    public function get empresa() : valueObjects.EmpresaVO
    {
        return _internal_empresa;
    }

    [Bindable(event="propertyChange")]
    public function get usuarioCadastro() : valueObjects.UsuarioVO
    {
        return _internal_usuarioCadastro;
    }

    [Bindable(event="propertyChange")]
    public function get nome() : String
    {
        return _internal_nome;
    }

    [Bindable(event="propertyChange")]
    public function get dataNascimento() : Date
    {
        return _internal_dataNascimento;
    }

    [Bindable(event="propertyChange")]
    public function get cpf() : String
    {
        return _internal_cpf;
    }

    [Bindable(event="propertyChange")]
    public function get dataCadastro() : Date
    {
        return _internal_dataCadastro;
    }

    public function clearAssociations() : void
    {
    }

    /**
     * data/source property setters
     */

    public function set usuarioUltimaAlteracaao(value:valueObjects.UsuarioVO) : void
    {
        var oldValue:valueObjects.UsuarioVO = _internal_usuarioUltimaAlteracaao;
        if (oldValue !== value)
        {
            _internal_usuarioUltimaAlteracaao = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "usuarioUltimaAlteracaao", oldValue, _internal_usuarioUltimaAlteracaao));
        }
    }

    public function set clienteEspecial(value:int) : void
    {
        var oldValue:int = _internal_clienteEspecial;
        if (oldValue !== value)
        {
            _internal_clienteEspecial = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "clienteEspecial", oldValue, _internal_clienteEspecial));
        }
    }

    public function set status(value:valueObjects.StatusVO) : void
    {
        var oldValue:valueObjects.StatusVO = _internal_status;
        if (oldValue !== value)
        {
            _internal_status = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "status", oldValue, _internal_status));
        }
    }

    public function set clienteEspecialFormatado(value:String) : void
    {
        var oldValue:String = _internal_clienteEspecialFormatado;
        if (oldValue !== value)
        {
            _internal_clienteEspecialFormatado = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "clienteEspecialFormatado", oldValue, _internal_clienteEspecialFormatado));
        }
    }

    public function set dataUltimaAlteracao(value:Date) : void
    {
        var oldValue:Date = _internal_dataUltimaAlteracao;
        if (oldValue !== value)
        {
            _internal_dataUltimaAlteracao = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "dataUltimaAlteracao", oldValue, _internal_dataUltimaAlteracao));
        }
    }

    public function set motivoStatus(value:String) : void
    {
        var oldValue:String = _internal_motivoStatus;
        if (oldValue !== value)
        {
            _internal_motivoStatus = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "motivoStatus", oldValue, _internal_motivoStatus));
        }
    }

    public function set enderecos(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_enderecos;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_enderecos = value;
            }
            else if (value is Array)
            {
                _internal_enderecos = new ArrayCollection(value);
            }
            else if (value == null)
            {
                _internal_enderecos = null;
            }
            else
            {
                throw new Error("value of enderecos must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "enderecos", oldValue, _internal_enderecos));
        }
    }

    public function set observacao(value:String) : void
    {
        var oldValue:String = _internal_observacao;
        if (oldValue !== value)
        {
            _internal_observacao = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "observacao", oldValue, _internal_observacao));
        }
    }

    public function set cargo(value:valueObjects.CargoVO) : void
    {
        var oldValue:valueObjects.CargoVO = _internal_cargo;
        if (oldValue !== value)
        {
            _internal_cargo = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "cargo", oldValue, _internal_cargo));
        }
    }

    public function set codigo(value:Number) : void
    {
        var oldValue:Number = _internal_codigo;
        if (oldValue !== value)
        {
            _internal_codigo = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "codigo", oldValue, _internal_codigo));
        }
    }

    public function set titulo(value:valueObjects.TituloVO) : void
    {
        var oldValue:valueObjects.TituloVO = _internal_titulo;
        if (oldValue !== value)
        {
            _internal_titulo = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "titulo", oldValue, _internal_titulo));
        }
    }

    public function set usuarioUltimaAlteracao(value:valueObjects.UsuarioVO) : void
    {
        var oldValue:valueObjects.UsuarioVO = _internal_usuarioUltimaAlteracao;
        if (oldValue !== value)
        {
            _internal_usuarioUltimaAlteracao = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "usuarioUltimaAlteracao", oldValue, _internal_usuarioUltimaAlteracao));
        }
    }

    public function set departamento(value:valueObjects.DepartamentoVO) : void
    {
        var oldValue:valueObjects.DepartamentoVO = _internal_departamento;
        if (oldValue !== value)
        {
            _internal_departamento = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "departamento", oldValue, _internal_departamento));
        }
    }

    public function set contatos(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_contatos;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_contatos = value;
            }
            else if (value is Array)
            {
                _internal_contatos = new ArrayCollection(value);
            }
            else if (value == null)
            {
                _internal_contatos = null;
            }
            else
            {
                throw new Error("value of contatos must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "contatos", oldValue, _internal_contatos));
        }
    }

    public function set empresa(value:valueObjects.EmpresaVO) : void
    {
        var oldValue:valueObjects.EmpresaVO = _internal_empresa;
        if (oldValue !== value)
        {
            _internal_empresa = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "empresa", oldValue, _internal_empresa));
        }
    }

    public function set usuarioCadastro(value:valueObjects.UsuarioVO) : void
    {
        var oldValue:valueObjects.UsuarioVO = _internal_usuarioCadastro;
        if (oldValue !== value)
        {
            _internal_usuarioCadastro = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "usuarioCadastro", oldValue, _internal_usuarioCadastro));
        }
    }

    public function set nome(value:String) : void
    {
        var oldValue:String = _internal_nome;
        if (oldValue !== value)
        {
            _internal_nome = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "nome", oldValue, _internal_nome));
        }
    }

    public function set dataNascimento(value:Date) : void
    {
        var oldValue:Date = _internal_dataNascimento;
        if (oldValue !== value)
        {
            _internal_dataNascimento = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "dataNascimento", oldValue, _internal_dataNascimento));
        }
    }

    public function set cpf(value:String) : void
    {
        var oldValue:String = _internal_cpf;
        if (oldValue !== value)
        {
            _internal_cpf = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "cpf", oldValue, _internal_cpf));
        }
    }

    public function set dataCadastro(value:Date) : void
    {
        var oldValue:Date = _internal_dataCadastro;
        if (oldValue !== value)
        {
            _internal_dataCadastro = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "dataCadastro", oldValue, _internal_dataCadastro));
        }
    }

    /**
     * Data/source property setter listeners
     *
     * Each data property whose value affects other properties or the validity of the entity
     * needs to invalidate all previously calculated artifacts. These include:
     *  - any derived properties or constraints that reference the given data property.
     *  - any availability guards (variant expressions) that reference the given data property.
     *  - any style validations, message tokens or guards that reference the given data property.
     *  - the validity of the property (and the containing entity) if the given data property has a length restriction.
     *  - the validity of the property (and the containing entity) if the given data property is required.
     */


    /**
     * valid related derived properties
     */
    model_internal var _isValid : Boolean;
    model_internal var _invalidConstraints:Array = new Array();
    model_internal var _validationFailureMessages:Array = new Array();

    /**
     * derived property calculators
     */

    /**
     * isValid calculator
     */
    model_internal function calculateIsValid():Boolean
    {
        var violatedConsts:Array = new Array();
        var validationFailureMessages:Array = new Array();

        var propertyValidity:Boolean = true;

        model_internal::_cacheInitialized_isValid = true;
        model_internal::invalidConstraints_der = violatedConsts;
        model_internal::validationFailureMessages_der = validationFailureMessages;
        return violatedConsts.length == 0 && propertyValidity;
    }

    /**
     * derived property setters
     */

    model_internal function set isValid_der(value:Boolean) : void
    {
        var oldValue:Boolean = model_internal::_isValid;
        if (oldValue !== value)
        {
            model_internal::_isValid = value;
            _model.model_internal::fireChangeEvent("isValid", oldValue, model_internal::_isValid);
        }
    }

    /**
     * derived property getters
     */

    [Transient]
    [Bindable(event="propertyChange")]
    public function get _model() : _FuncionarioVOEntityMetadata
    {
        return model_internal::_dminternal_model;
    }

    public function set _model(value : _FuncionarioVOEntityMetadata) : void
    {
        var oldValue : _FuncionarioVOEntityMetadata = model_internal::_dminternal_model;
        if (oldValue !== value)
        {
            model_internal::_dminternal_model = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "_model", oldValue, model_internal::_dminternal_model));
        }
    }

    /**
     * methods
     */


    /**
     *  services
     */
    private var _managingService:com.adobe.fiber.services.IFiberManagingService;

    public function set managingService(managingService:com.adobe.fiber.services.IFiberManagingService):void
    {
        _managingService = managingService;
    }

    model_internal function set invalidConstraints_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_invalidConstraints;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_invalidConstraints = value;
            _model.model_internal::fireChangeEvent("invalidConstraints", oldValue, model_internal::_invalidConstraints);
        }
    }

    model_internal function set validationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_validationFailureMessages;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_validationFailureMessages = value;
            _model.model_internal::fireChangeEvent("validationFailureMessages", oldValue, model_internal::_validationFailureMessages);
        }
    }


}

}
